<?php

namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Session;
use think\Request;
class Comment extends Controller{
    /****
     * Class register          	        校园咨询添加
     * @$post['pid']                 資訊动态id
     * @$post['user_id']        	    1咨询，0图文
     * @$post['reply_user_id']       内容
     * @$post['content']             位置
     * @date                	        2020/06/02 
     * @package application\index\controller\Comment
     ->join('user b','b.id=a.user_id','LEFT')
           ->join('headline_consult_comment c','find_in_set(a.user_id,c.reply_user_id)','LEFT')
           ->field("a.*,b.avatar,b.username")
    */
    public function index(){
       $post = input('post.');
       // echo json_encode($post);exit();
       $headline_consult_comment = Db::name('headline_consult_comment')
           ->where(['pid'=>$post['pid']])
           ->select();
        
        if($headline_consult_comment){
             $arr = [
               'state'     => 1,
               'headline_consult_comment'=>$headline_consult_comment,
               'message'  => "请求成功"
            ];
        }else{
            $arr = [
               'state'     => 1,
               'message'  => "请求成功"
            ];
        }
        return json($arr);
    }

}
